<!-- Autocomplete fields need to be refactored and moved to a helper, but I'd like to make them completely functional first. -->
<fieldset class="work-meta">
  <p><%= "Story Tags (comma separated)".t -%><%= link_to_help "tagging-help" -%></p>
  <dl>
    <dt class="rating required">
      <label for="work_rating_string"><%= Rating::NAME.t -%>*<%= link_to_help "rating-help" -%></label>
    </dt>
    <dd class="rating required">
      <%= collection_select(:work, :rating_string, Rating.canonical, :name, :name) -%>		
    </dd>
    <dt class="warning required">
      <label for="work_warning"><%= Warning::NAME.t -%>*<%= link_to_help "warning-help" -%></label>
    </dt>
    <dd class="warning required">
      <select id="work_warning" name="work[warning_strings][]" multiple="multiple">
        <%= options_from_collection_for_select(Warning.canonical, :name, :name, warning_selected(@work) ) -%>
      </select>
    </dd>
    <dt class="category required">
      <label for="work_category_string"><%= Category::NAME.t -%>*</label>
    </dt>
    <dd class="category required">
      <%= collection_select(:work, :category_string, Category.canonical, :name, :name, {:prompt => true}) -%>		
    </dd>
    <dt class="fandom required">
      <label for="work_fandom"><%= Fandom::NAME.pluralize.t -%>*</label>
    </dt>
    <dd class="fandom required">
      <input type="text" name="work[fandom_string]" id="work_fandom" value="<%= @work.fandom_string %>" />
      <div class="auto_complete" id="work_fandom_auto_complete" ></div>
      <%= javascript_tag("new Autocompleter.Local('work_fandom', 'work_fandom_auto_complete', Fandom.canonical.find(:all, :order => :name).map(&:name).to_json}, {tokens: ','});") %>
    </dd>
	<dd class="fandom delay_notice"><%=h "If this is the first story for a fandom, it may not show up in the fandoms page for a day or two".t %></dd>
    <dt class="pairing">
      <label for="work_pairing"><%= Pairing::NAME.pluralize.t -%></label>
    </dt>
    <dd class="pairing">
      <input type="text" name="work[pairing_string]" id="work_pairing" value="<%= @work.pairing_string %>"/>
      <div class="auto_complete" id="work_pairing_auto_complete" ></div>
      <%= javascript_tag("new Autocompleter.Local('work_pairing', 'work_pairing_auto_complete', Pairing.canonical.find(:all, :order => :name).map(&:name).to_json}, {tokens: ','});") %>
    </dd>
    <dt class="character">
      <label for="work_character"><%= Character::NAME.pluralize.t -%></label>
    </dt>
    <dd class="character">
      <input type="text" name="work[character_string]" id="work_character" value="<%= @work.character_string %>" />
      <div class="auto_complete" id="work_character_auto_complete" ></div>
      <%= javascript_tag("new Autocompleter.Local('work_character', 'work_character_auto_complete', Character.canonical.find(:all, :order => :name).map(&:name).to_json}, {tokens: ','});") %>
    </dd>
    <dt class="freeform">
      <label for="work_freeform"><%= Freeform::NAME.pluralize.t -%></label>
    </dt>
    <dd class="freeform">
      <input type="text" name="work[freeform_string]" id="work_freeform" value="<%= @work.freeform_string %>" />
      <div class="auto_complete" id="work_freeform_auto_complete" ></div>
      <%= javascript_tag("new Autocompleter.Local('work_freeform', 'work_freeform_auto_complete', Common.canonical.find(:all, :order => :name).map(&:name).to_json}, {tokens: ','});") %>
    </dd>
  </dl>
</fieldset>
